/**
 * 密码加密
 */
const jwt = require("jsonwebtoken");
const crypto = require("crypto");
module.exports = {
    getToken(pwd) {
        return jwt.sign(pwd, this.app.config.keys, { expiresIn: "2h" });
    },
    checkToken(pwd) {
        return jwt.verify(pwd, this.app.config.keys);
    },
    enCrypto(pwd) {
        return crypto
            .createHmac("sha256", this.app.config.keys)
            .update(pwd)
            .digest("hex");
    },
};
